import { ConfigService } from '@nestjs/config'
import { JwtModuleAsyncOptions } from '@nestjs/jwt'

import { IConfig } from '@/interfaces'

export const JWT_OPTIONS: JwtModuleAsyncOptions = {
  global: true,
  useFactory(configService: ConfigService) {
    return configService.get<IConfig['jwt']>('jwt')
  },
  inject: [ConfigService]
}
